const axios = require('axios').default;
const delay = require('delay');

async function post(i) {

    try {
        let resp = await axios.post('http://127.0.0.1:3000/test', {
            firstName: 'Fred',
            lastName: 'Flintstone'
        });
        console.log(i, resp.status, resp.data);
    } catch (err) {
        console.log(i, err.code, err.message);
    }

    return true;
}

async function start() {
    for (let i = 1; i <= 500; i++) {
        await post(i);
        await delay(300);
    }
    process.exit();
}

start();